<extend name="Base/common"/>
<block name="body">
    <div class="insurance">
        <div class="width1000">
            <div class="step_info">
                <div class="write_info">录入保单信息</div>
                <div class="get_price">获取精确报价</div>
                <div class="cash_money on">支付保单</div>
                <div style="clear:both"></div>
            </div>
            <div class="ins_tab">
                <a href="javascript:void(0);" class="f_l ins_tab_li">定制我的车险</a>
            </div>
    <div class="confirm_order width1000">
        <div class="confirm_detail clearfix" style="  margin-top: 2em;">
          <span style="font-weight: 700;" >{$data.c_lcn_no}</span>            
            <span style="font-weight: 700;">订单号：{$data.c_order_no}</span>
            <span class="confirm_d_time">下单时间：{$data.transrdate}</span>
            <span class="f_r confirm_d_money">
                ￥:{$data['n_real_amt']+$data['n_traff_real_prm']+$data['n_tax_real_prm']}元
            </span>
        </div>
         <div class="order_border hide">
                    <table class="table table-hover">
                        <thead>
                        <tr>
                            <th>
                                承保险种
                            </th>
                            <th class="policy_money">
                                保险金额/赔偿限额(元)
                            </th>
                            <th class="policy_money">
                                折前保费
                            </th>
                            <th class="policy_money">
                                应缴保费(元)
                            </th>
                        </tr>
                        </thead>
                        <tbody>
                        <volist name="kindlist" id="item">
                            <tr>
                                <td class="policy_msg">
                                    <p>{$item.C_KIND_NAME}</p>
                                </td>
                                <td class="policy_money">
                                    <p><if condition="$item['N_AMT'] eq 0">&nbsp;<else />{$item.N_AMT}</if></p>
                                </td>
                                <td class="policy_money">
                                    <p>￥{$item.N_BEN_PRM}</p>
                               </td>
                                <td class="policy_money">
                                    <p>￥{$item.N_PRM}</p>
                                </td>
                            </tr>
                        </volist>
                            <tr>
                                <td class="policy_msg">
                                    <p>交强险</p>
                                </td>
                                <td class="policy_money">
                                    <p>&nbsp;</p>
                                </td>
                                <td class="policy_money">
                                    <p>￥{$n_traff_prm}</p>
                               </td>
                                <td class="policy_money">
                                    <p>￥{$n_traff_real_prm}</p>
                                </td>
                            </tr>
                            <tr>
                                <td class="policy_msg">
                                    <p>车船税</p>
                                </td>
                                <td class="policy_money">
                                    <p>&nbsp;</p>
                                </td>
                                <td class="policy_money">
                                    <p>￥{$n_tax_prm}</p>
                               </td>
                                <td class="policy_money">
                                    <p>￥{$n_tax_real_prm}</p>
                                </td>
                            </tr>
                        </tbody>
                        <tfoot>
                            <tr>
                                <td colspan="4" class="policy_msg">
                                    保费合计：
                                    {$n_real_prm+$n_traff_real_prm+$n_tax_real_prm|cny}
                                    &nbsp;&nbsp;<span class="order_bottom_money2">￥{$n_real_prm+$n_traff_real_prm+$n_tax_real_prm}</span>
                                </td>
                            </tr>
                        </tfoot>
                    </table>               
            </div>
      
        <form action="{:U('finish')}" method="post" class="form_all" id="forms">
        	<div>
        		<div class="clear form_list">
                    <div class="span3 f_l t_r">
                        <span class="form_list_left">车主姓名</span>
                    </div>
                    <div class="span7 f_l">
                        <input type="text" name="c_drv_owner" id="c_drv_owner" value="{$user.c_drv_owner}" />
                        <span class="help_msg"></span>
                    </div>
                </div>
                <div class="clear form_list">
                    <div class="span3 f_l t_r">
                        <span class="form_list_left">身份证号：</span>
                    </div>
                    <div class="span7 f_l">
                        <input type="text" id="c_ident_no" name="c_ident_no" value="{$user.ident_no}"/>
                        <span class="help_msg"></span>
                    </div>
                </div>
                <div class="clear form_list">
                    <div class="span3 f_l t_r">
                        <span class="form_list_left">手机号码：</span>
                    </div>
                    <div class="span7 f_l">
                        <input type="text" name="mobile" id="mobile" value="{$user.mobile}" />
                        <span class="help_msg"></span>
                    </div>
                </div>
                <div class="clear form_list">
                    <div class="span3 f_l t_r">
                        <span class="form_list_left">验证码</span>
                    </div>
                    <div class="span7 f_l">
                        <input type="text" name="verify" />
                        <input type="button" class="code btn_hover" id="get_verify" value="获取验证码">
                        <span class="help_msg"></span>
                    </div>   			
        	</div>
        	
        	<div>
                <div class="order_more_tit">
                配送信息
                <div class="f_r clearfix order_add">
                    <span class="order_address"></span>
                    <span class="order_add_word">添加地址</span>
                </div>
            </div>
            <div class="address_detail" id="addr_list_div">
            <volist name="address" id="vo">
                <div class="clearfix add_list">
                    <div class="span1 f_l">
                        <input type="radio" id="add_{$vo.aid}" name="aid" value="{$vo.aid}" <if condition="$i eq 1">checked="checked"</if> />
                    </div>
                    <div class="span2 f_l">
                        收件人：{$vo.recvname}
                    </div>
                    <div class="span3 f_l">
                        手机号码：{$vo.mobile}
                    </div>
                    <div class="span4 f_l">
                        收货地址：{$vo.province}{$vo.city}{$vo.area}{$vo.address}
                    </div>
                </div>
            </volist>
        	
        	</div>
        	</div>
            <div class="order_more_tit">
             	  选择配送方式
                
                </div>
            <div class="clearfix con_list">
                <div class="span3 f_l t_r">
                    <span>配送方式</span>
                </div>
                <div class="span7 f_l select_label">
                    <label for="con1" class="on">送货上门</label>
                    <input type="radio" class="hide" id="con1" name="sendtype" value="1" checked="checked" />
                    <label for="con2">营业厅自取</label>
                    <input type="radio" class="hide" id="con2" name="sendtype" value="2" />
                    <span class="help_msg"></span>
                </div>
            </div>
            <div class="clearfix con_list">
                <div class="span3 f_l t_r">
                    <span>支付方式：</span>
                </div>
                <div class="span7 f_l">
                    <select name="c_payment_type"  class="con_list_select" id="select_pay">
                        <option value="01">在线支付</option>
                        <option value="02">上门收款</option>
                    </select>
                    <span class="help_msg"></span>
                </div>
            </div>
            <div class="clearfix con_list" id="select_pay_detail">
                <div class="span7 f_l select_label select_label2">
                    <label for="pay2" class="pay_zhifubao on"></label>
                    <input type="radio" class="hide" id="pay2" checked="checked" value="0" name="test"/>

                    <label for="pay1" class="pay_weixin"></label>
                    <input type="radio" class="hide" id="pay1" value="1" name="test" />
                </div>
            </div>
            <div class="con_btn t_c clear">
                <input type="submit" value="确认付款" class="confirm btn_hover" />
            </div>
        </form> 
    </div>
        </div>
    </div>
    <div class="pop_content">
        <div class="new_address">
            <form action="#" method="post" id="formAddr">
                <span class="pop_close"></span>
                <div class="add_list">
                    <span>省市：</span>
                    <select name="province" id="province" class="required"></select>
                    <select name="city" id="city" class="required"></select>
                    <select name="area" id="area" class="required"></select>
                </div>
                <div class="add_list">
                    <span>具体地址：</span>
                    <input type="text" name="address" class="required" />
                </div>
                <div class="add_list">
                    <span>联系人：</span>
                    <input type="text" name="recvname" class="required" value="{$user.realname}" />
                </div>
                <div class="add_list">
                    <span>联系电话：</span>
                    <input type="text" name="mobile" class="required" value="{$user.mobile}" />
                </div>
                <input type="submit" value="提交" class="add_submit"/>
            </form>
        </div>
    </div> 
    </block>
<block name="script">
<script type="text/javascript" src="__PUBLIC__/Green/js/insurance.js"></script>
<script type="text/javascript" src="__PUBLIC__/Green/js/datePicker.js"></script>
<script type="text/javascript">
 new PCAS("province","city","area");
 
 $('#frmOrder').validate({
    rules:{
        c_ident_no:{
            required:true,
            maxlength:18,
            minlength:18
        },
        c_app_email:{
            required:true,
            email:true
        },
        aid:{
            required:true
        }
    },
    messages:{
        c_ident_no:{
            required:'请输入身份证号码',
            maxlength:'身份证号码长度为18位，请验证',
            minlength:'身份证号码长度为18位，请验证'
        },
        c_app_email:{
            required:'请填写电子邮件地址',
            email:'无效的电子邮件地址'
        },
        aid:{
            required:'请选择配送地址'
        }
    }  
 });
 $('#formAddr').validate({
    submitHandler:function(form){
        $.post("{:U('User/address')}",$(form).serialize(),function(data){
            if(data.status){
                var str = '<div class="clearfix add_list"><div class="span1 f_l">'+
                        '<input type="radio" id="add_'+ data.info.aid + '" name="aid" value="' + data.info.aid +'" />'+
                        '</div><div class="span2 f_l">收件人：'+data.info.recvname + 
                        '</div><div class="span3 f_l">手机号码：'+data.info.mobile+'</div><div class="span4 f_l">'+
                        '收货地址：'+ data.info.province + data.info.city+data.info.area+data.info.address +'</div></div>';
                $(str).appendTo($('#addr_list_div'));
                $("#formAddr")[0].reset();
                $(".pop_content").hide();
            }else{
                alert(data.info);
            }
        },'json');
    } 
});
 
 var wait_time_g = 60; //60秒内


 function wait_next_g(){
     if(wait_time_g<=0){
         $('#get_verify').attr("disabled", false).val('获取验证码');
         wait_time_g = 60;
     }else{
         wait_time_g --;
         $('#get_verify').attr("disabled", true).val('还有' + wait_time_g + '秒');
         setTimeout('wait_next_g()',1000);
     }
 }

     
     $('#get_verify').click(function(){
         var url = "{:U('User/getVerifyMsg')}",
             mobile = $('#mobile').val();
        $.post(url,{mobile:mobile,forget:0},function(data){
                 if(data.status){
                     wait_next_g();
                 } else {
                     alert(data.info);
                 }
        },"json"); 
     });
 
</script>

</block>
